# 求解约瑟夫环问题

def exitCircle(m, k, i):
    if i == 1:
        return (m + k - 1) % m
    else:
        return (exitCircle(m - 1, k, i - 1) + k) % m

x=[]
n=eval(input("输入人数"))
k=eval(input("输入序号"))
for i in range(1, n + 1):
    print(exitCircle(n, k, i) + 1)